#include <VolumeUnit.h>

const unsigned int OZ_TO_TSP       = 3;
const unsigned int TSP_TO_TBSP     = 4;
const unsigned int BASE_UNIT_VALUE = 1;

const VolumeUnit* VolumeUnit::getOzInstance()
{
    static VolumeUnit oz(OZ_TO_TSP, TSP);
    return &oz;
}

const VolumeUnit* VolumeUnit::getTspInstance()
{
    static VolumeUnit tsp(TSP_TO_TBSP, TBSP);
    return &tsp;
}

const VolumeUnit* VolumeUnit::getTbspInstance()
{
    static VolumeUnit tbsp(BASE_UNIT_VALUE, 0);
    return &tbsp;
}

VolumeUnit::VolumeUnit(unsigned int factor, const VolumeUnit* referenceUnit)
    : baseUnitConversion(factor, referenceUnit)
{
}

unsigned int VolumeUnit::toBase() const
{
    return baseUnitConversion.toBase();
}
